<template>
    <div style="margin: 15px">
        <el-input
            v-model="form.username"
            placeholder="请输入用户名"
            size="medium"
            prefix-icon="el-icon-user"
            @change="change"
        ></el-input>
        <el-button type="" @click="click">test</el-button>
    </div>
</template>
<script>
let i = 0
export default {
    data() {
        return {
            form: {}
        }
    },
    methods: {
        change() {
            console.log(this.form)
        },
        click() {
            console.log(this)
            this.form = { username: 123 }
        }
    },
    created() {
        console.log(this.form)
    },
    mounted() {
        console.log(this.form)
    },
    updated() {
        console.log(this.form)
    },
    beforeRouteEnter(to, from, next) {
        next((vm) => {
            console.log('beforeRouteEnter')
            vm.form = { username: ++i }
        })
    },
    watch: {
        form(v1, v2) {
            console.log(v1)
            console.log(v2)
        }
    }
}
</script>
